using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Windows.Forms;

namespace TestWebServiceClient
{
    public partial class _Default : System.Web.UI.Page
    {
        private net.terraservice.TerraService ts = new net.terraservice.TerraService();

        protected void Page_Load(object sender, EventArgs e)
        {
            //chkBxToggle.Appearance = System.Windows.Forms.Appearance.Button;
           // chkBxToggle.
            //    System.Windows.Forms.CheckBox ch = new System.Windows.Forms.CheckBox();
            //ch.ap
            if (this.IsPostBack == false)  // First Time run
            {
                wucTogBut.toggleButA.Text = "initial";
            }
        }

        protected void butShowSydney_Click(object sender, EventArgs e)
        {
            //Create place holder for Sydney
            net.terraservice.Place searchPlace = new net.terraservice.Place();
            searchPlace.City = "Seattle";

            //Define objects to retrieve info
            net.terraservice.PlaceFacts facts;
            searchPlace.Country = "USA";
            searchPlace.State = "Washington";

            //Call web service
            facts = ts.GetPlaceFacts(searchPlace);

            //Display results
            this.ShowPlaceFacts(facts);

        }

        private void ShowPlaceFacts(net.terraservice.PlaceFacts facts)
        {
            lblResult.Text = "<b> Place: " + facts.Place.City + " </b><br><br>";
            lblResult.Text += facts.Place.State + ", " + facts.Place.Country;
            lblResult.Text +="<br> Lat: " + facts.Center.Lat.ToString();
            lblResult.Text +="<br> Long: " + facts.Center.Lon.ToString();
            lblResult.Text += "<br><br>";
        }
    }
}
